import request from '@/utils/request';

// 获取商机列表
export function getOpportunitiesList(params: any) {
  return request({
    url: `/tienchin/business/list`,
    method: 'GET',
    params
  });
}

// 删除商机(可多个)
export function deleteOpportunities(businessIds: any) {
  return request({
    url: `/tienchin/business/${businessIds}`,
    method: 'DELETE',
    data: businessIds
  });
}


// 根据id查询商机
export function getOpportunity(id: any) {
  return request({
    url: `/tienchin/business/${id}`,
    method: 'GET'
  });
}

// 根据商机ID查询一个商机的摘要信息
export function getOpportunityById(id: any) {
  return request({
    url: `/tienchin/business/summary/${id}`,
    method: 'GET'
  });
}

// 获取所有渠道
export function getChannels() {
  return request({
    url: `/tienchin/business/channels`,
    method: 'GET'
  });
}

// 更新商机
export function updateOpportunity(data: any) {
  return request({
    url: `/tienchin/business`,
    method: 'PUT',
    data
  });
}

// 查询归属部门
export function getDepartmentsList() {
  return request({
    url: `system/dept/treeselect`,
    method: 'GET'
  });
}

// 根据活动ID查询一个具体的活动
export function getActivityById(channelId: number) {
  return request({
    url: `/tienchin/clue/activity/${channelId}`,
    method: 'GET'
  });
}

// 添加商机
export function addOpportunity(data: object) {
  return request({
    url: `/tienchin/business`,
    method: 'POST',
    data
  });
}

// 根据id查询部门具体信息
export function getDepartmentById(id: number) {
  return request({
    url: `tienchin/clue/users/${id}`,
    method: 'GET'
  });
}

// 分配商机接口
export function assignOpportunities(data: object) {
  return request({
    url: `tienchin/assignment`,
    method: 'POST',
    data
  });
}

// 详情页查询性别
export function getGender() {
  return request({
    url: `system/dict/data/type/sys_user_sex`,
    method: 'GET'
  });
}

// 详情页查询学历
export function getEducation() {
  return request({
    url: `/system/dict/data/type/business_education`,
    method: 'GET'
  });
}

// 详情页查询职业
export function getProfession() {
  return request({
    url: `/system/dict/data/type/business_occupation`,
    method: 'GET'
  });
}

// 详情页查询意向分类
export function getIntention() {
  return request({
    url: `/system/dict/data/type/course_type`,
    method: 'GET'
  });
}

// 根据意向类型查询课程
export function getCourseByType(type: any) {
  return request({
    url: `/tienchin/business/course/${type}`,
    method: 'GET'
  });
}

// 跟进状态
export function getFollowStatus() {
  return request({
    url: `/system/dict/data/type/business_status`,
    method: 'GET'
  });
}

// 沟通重点
export function getCommunication() {
  return request({
    url: `/system/dict/data/type/business_focus`,
    method: 'GET'
  });
}

// 保存商机信息
export function saveBusiness(data: any) {
  return request({
    url: `tienchin/business/follow`,
    method: 'POST',
    data
  });
}

// 获取商机跟进记录
export function getBusinessFollow(id: any) {
  return request({
    url: `/tienchin/follow/record/business/${id}`,
    method: 'GET'
  });
}
